package com.grouuu.keyboard;
import starling.core.Starling;
import starling.events.KeyboardEvent;

/**
 * ...
 * @author Grouuu
 */

class KeyListener 
{
	public function new() 
	{
		
	}
	
	public function addListener(listener:IKey):Void
	{
		Starling.current.stage.addEventListener(KeyboardEvent.KEY_DOWN, listener.onKeyDown);
		Starling.current.stage.addEventListener(KeyboardEvent.KEY_UP, listener.onKeyUp);
	}
	
	public function removeListener(listener:IKey):Void
	{
		Starling.current.stage.removeEventListener(KeyboardEvent.KEY_DOWN, listener.onKeyDown);
		Starling.current.stage.removeEventListener(KeyboardEvent.KEY_UP, listener.onKeyUp);
	}
}